layui.config({
    base : "/dhjdglxt/modules/util/"//自定义加载的模块
}).use(['layer','jquery','layedit','laydate','laypage','table','commUtil'],function(){
    var layer = parent.layer === undefined ? layui.layer : parent.layer,
        laypage = layui.laypage,
        layedit = layui.layedit,
        laydate = layui.laydate,
        $ = layui.jquery;
    var table = layui.table;
    var commUtil = layui.commUtil;
    var flowRecId =  $("#recId",parent.document).val();
    
    function getQueryString(name) { 
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
        var r = window.location.search.substr(1).match(reg); 
        if (r != null) return unescape(r[2]); 
        return null; 
    } 
    
    //加载模块信息
    table.render({
        id:'processLogListTable'
        ,page:false
        ,elem: '#processLogListTable'
        ,url:basePath+'/service/airplanebaseinfo/airplanebaseinfo/listIdeaInfo?flowRecId='+flowRecId
        ,cellMinWidth: 100
        ,cols: [[
        	{field:'ideaType', width:'13%', title: '日志类别', align: 'center',event:'setSign'}
            ,{field:'unitName', width:'18%', title: '主办处室',align: 'center',event:'setSign'}
            ,{field:'userName', width:'19%', title: '办理人员',align: 'center',event:'setSign'}
            ,{field:'updateTime', width:'17%', title: '办理时间',align: 'center',event:'setSign'}
            ,{field:'ideaCode', width:'10%', title: '办理结果',align: 'center',event:'setSign'}
            ,{field:'content', width:'23%',title: '意见',align: 'center',event:'setSign',templet: '#contentTpl'}

        ]],
        done:function(res, curr, count){
        	parent.frameWH();
        }
    });

    //监听工具条
    table.on('tool(processLogListTable)', function(obj){
        var data = obj.data;
        if(obj.event === 'optLink'){
            optLink(data.nodeInstId,data)
        }
    });
	document.onkeydown=function(event){
		var e = event || window.event || arguments.callee.caller.arguments[0];
		if(e && e.keyCode==13){ // enter 键
			onQuery();
		}
		};
    $(".onQuery").click(function(){
        onQuery();
    })

    //查询
    function onQuery(){
        table.reload('processLogListTable', {
            page : {
                curr : 1 // 重新从第 1 页开始
            }
        });
    }
    
    //办理
    function optLink(procId,data){
    	var fileId = data.fileId;
        location.href=parent.window.UploaderPath + "service/download/pfile/" + fileId;
    }
    
})

